/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

$(function() {
    resize();
    window.onresize = resize;
});

function resize() {
    if ($('.art-title').height() <= 27) {
        $('.art-title').css('text-align', 'center');
    } else {
        $('.art-title').css('text-align', 'left');
    }
}

function pvShareCallback() {
    $.get('/?/Gmess/ajaxUpShare/id=' + msgid);
}

function gmessOnload() {
    var catimg = $('#share-img').val();
    var sharetitle = $('#share-title').val();
    var sharedesc = $('#share-desc').val();
    msgid = $('#msgid').val();
    WeixinJSBridge.on('menu:share:timeline', function(argv) {
        WeixinJSBridge.invoke('shareTimeline', {
            "img_url": catimg,
            "img_width": "200",
            "img_height": "200",
            "link": window.location.href,
            "desc": sharedesc,
            "title": sharetitle
        }, function() {
            pvShareCallback();
        });
    });
    WeixinJSBridge.on('menu:share:appmessage', function(argv) {
        WeixinJSBridge.invoke('sendAppMessage', {
            "appid": $.cookie('appid'),
            "img_url": catimg,
            "img_width": "300",
            "img_height": "300",
            "link": window.location.href,
            "desc": sharedesc,
            "title": sharetitle
        }, function() {
            pvShareCallback();
        });
    });
}